package com.ruoyi.lab.utils;

import java.util.HashMap;
import java.util.Map;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.lab.domain.JacTestOutline;
import com.ruoyi.lab.domain.JacTestProject;
import com.ruoyi.lab.domain.JacTestProjectLog;

public class MyTool extends BaseController{
	protected Map<String,String> jacResultMsg(String result)
	{
		Map<String,String> r = new HashMap<String,String>();
		if ("1".equals(result))
		{
		r.put("msg", "success");
		r.put("code", "0");
		return r;
		}
			if (StringUtils.contains(result, "管理员"))
			{
				r.put("msg", result);
				r.put("code", "500");
				return r;
			}
			else
		{
			r.put("msg", result);
			r.put("code", "505");
			return r;
		}
	}
	public static String getLimit(String orderBy,int start,int end){
		String limit=null;
		if(null!=orderBy){
			limit="order by"+" "+orderBy+" "+"limit"+" "+start+", "+end;
		}else
		{
			limit= "limit"+" "+start+", "+end;
		}
		return limit;
	}
  public static JacTestProjectLog ConvertJacTestProjectTOJacTestLogProject(JacTestProject jacTestProject){
	  JacTestProjectLog jtpp = new JacTestProjectLog();
	  jtpp.setItemcode(jacTestProject.getItemcode());
	  jtpp.setExbegintime(jacTestProject.getExbegintime());
	  jtpp.setExendtime(jacTestProject.getExendtime());
	  jtpp.setExperimentmethod(jacTestProject.getExperimentmethod());
	  jtpp.setExperimentname(jacTestProject.getExperimentname());
	  jtpp.setExperimentrequest(jacTestProject.getExperimentrequest());
	  jtpp.setExperimentsite(jacTestProject.getExperimentsite());
	  jtpp.setSampleamount(jacTestProject.getSampleamount());
	  jtpp.setExperimentcode(jacTestProject.getExperimentcode());
	  jtpp.setExperimentstage(jacTestProject.getExperimentstage());
	  jtpp.setExperimentitem(jacTestProject.getExperimentitem());
	  jtpp.setExperimenttype(jacTestProject.getExperimenttype());
	  jtpp.setExperimentresult(jacTestProject.getExperimentresult());
	  return jtpp;
  }
  public static  JacTestOutline selectJacTestOutLineByRequirements(JacTestOutline jacTestOutline) {

	  JacTestOutline myjacTestOutline=new JacTestOutline();
	  myjacTestOutline=jacTestOutline;
	  if (null != jacTestOutline.getStatuslist()) {
		  myjacTestOutline.setMyarray(Convert.toStrArray(jacTestOutline.getStatuslist()));
	  }
	  if (null != jacTestOutline.getStages()) {
		  myjacTestOutline.setStagelist(Convert.toStrArray(jacTestOutline.getStages()));
	  }
	  if (null != jacTestOutline.getProjectcodes()) {
		  myjacTestOutline.setProjectcodelist(Convert.toStrArray(jacTestOutline.getProjectcodes()));
	  }
	  return myjacTestOutline;
  }
}
